package com.itheima06;

/**
 * @author Xiao
 * @date 2021/7/18
 */
public class InnerDemo03 {
    public static void main(String[] args) {
        Inter i = new Inter() {
            @Override
            public void show1() {
                System.out.println("show1");
            }

            @Override
            public void show2() {
                System.out.println("show2");
            }

            @Override
            public int show3() {
                int a = 10;
                int b = 20;
                return a + b;
            }

            @Override
            public void show4(String s) {
                System.out.println(s);
            }

            @Override
            public String show5(String s) {
                //String valueOf(int i)：将整型数据i转为字符串类型
                return String.valueOf(s.length());
            }
        };
        i.show1();
        i.show2();
        System.out.println("show3:" +i.show3());
        i.show4("show4:HelloWorld");
        System.out.println("show5:" + i.show5("itheima"));

    }
}

interface Inter {
    void show1();
    void show2();
    int show3();
    void show4(String s);
    String show5(String s);
}